package jannex.query;

import jannex.query.conditional.Predicate;
import jannex.query.conditional.Equal;
import jannex.query.conditional.NotEqual;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Where<E> extends Clause<E> {

    private List<Predicate> predicates = new ArrayList<>();

    Where(Binding<E> binding, Predicate... predicates) {
        super(binding);
        this.predicates.addAll(Arrays.asList(predicates));
    }

    Where(Binding<E> binding, E e) {
        super(binding);
        // TODO
    }

    Where(Binding<E> binding) {
        super(binding);
    }

    /**
     * Anded conditionals.
     */
    public Where(Predicate... predicates) {
        this(null, predicates);
    }

    public Where(E e) {
        this(null, e);
    }

    public Where<E> equal(String columnName, Object value) {
        predicates.add(new Equal(columnName, value));
        return this;
    }

    public Where<E> notEqual(String columnName, OrderBy value) {
        predicates.add(new NotEqual(columnName, value));
        return this;
    }

    public Where<E> greaterThan(String columnName, Number number) {
        return this;
    }

    public Where<E> greaterThanOrEqual(String columnName, Number number) {
        return this;
    }

    public Where<E> lessThan(String columnName, Number number) {
        return this;
    }

    public Where<E> lessThanOrEqual(String columnName, Number number) {
        return this;
    }

    public Where<E> isNull(String columnName) {
        return this;
    }

    public Where<E> isNotNull(String columnName) {
        return this;
    }

    public Where<E> in(String columnName, List<Object> values) {
        return this;
    }

    @SafeVarargs
    public final <C> Where<E> in(String columnName, C... values) {
        return this;
    }

    public <C> Where<E> in(String columnName, Select<?> select) {
        return this;
    }

    public Where<E> like(String columnName, String value) {
        return this;
    }

    public Where<E> notLike(String columnName, String value) {
        return this;
    }


    public Where<E> and(Predicate... predicates) {
        return this;
    }

    public Where<E> or(Predicate... predicates) {
        return this;
    }

    public Where<E> literal() {
        return this;
    }

    public OrderBy<E> orderBy(String... columnNames) {
        return new OrderBy<>(columnNames);
    }

    public GroupBy<E> groupBy(String... columnNames) {
        return new GroupBy<>(columnNames);
    }

}
